<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.ahp.bean.Module"%>
<%@page import="java.util.Set"%>
<%@page import="com.ahp.bean.Factor"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@ include file="../include/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>选择模板</title>
<script type="text/javascript" src="<%=path %>/js/jquery-1.3.2.js"></script>
<link rel="stylesheet" href="<%=path%>/style/style_manage.css" type="text/css"></link>
<style type="text/css">
.added{border: 1px solid gray; margin: 1em 1em; padding: 5px 8px;}
.delSpan{cursor: pointer;}
div{line-height: 150%;}
</style>
<script type="text/javascript">

</script>
</head>
<body>
<div id="management">
	<h1 style="position: relative;">选择评估模板</h1>
	<div id="result" style="color:red;"></div>
	<%
	Map<String,Map<Integer,Set<Factor>>> modMap = null;
	if(request.getAttribute("modMap")!=null){
		modMap = (Map<String,Map<Integer,Set<Factor>>>)request.getAttribute("modMap");
	}
		if(request.getAttribute("modules")!=null){
			List<Module> moduleList = (List<Module>)request.getAttribute("modules");
			%><table border="1" cellpadding="0" cellspacing="0" class="table">
				<tbody>
					<tr>
						<th>模板名称</th>
						<th>模板类型</th>
						<th>模板因子</th>
						<th>操作</th>
					</tr>
				<%for(int i =0;i<moduleList.size();i++){
					Module mod = moduleList.get(i);
					Set<Factor> facSet = mod.getFactors();
					Map<Integer,String> facNameMap = new HashMap<Integer,String>();
					for(Factor fa : facSet){
						facNameMap.put(fa.getFacId(),fa.getName());
					}
				 %>
					<tr>
						<td align="center"><%=mod.getName() %></td>
						<td align="center"><%=mod.getType() %></td>
						<td><%
						Map<Integer,Set<Factor>> lev1Map = modMap.get("mod"+mod.getModId());
						for(Iterator<Integer> it = lev1Map.keySet().iterator(); it.hasNext();){
							Integer facId = it.next();
							out.print(facNameMap.get(facId)+":");
							Set<Factor> faSet = lev1Map.get(facId);
							for(Factor factor : faSet){
								out.print(factor.getName()+"&nbsp;");
							}
							out.print("<br/>");
						}
						%></td>
						<td>
						<a href="<%=path %>/mod/inputLevelOne.action?module.modId=<%=mod.getModId() %>">选择</a>
						</td>
					</tr>
				<%} %>
				</tbody>
			</table><%
		}
	%>
</div>
</body>
</html>